﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace MapWindowDocking
{
    public class Globals
    {
        /// <summary>
        /// The US culture info used when reading and sending information to and from Mapinfo.
        /// </summary>
        public static CultureInfo uscultureInfo = new CultureInfo("en-US");

        /// <summary>
        /// The US number format used to parse decimals from Mapinfo.
        /// </summary>
        public static NumberFormatInfo _usNumberFormat = uscultureInfo.NumberFormat;

        private static FavouriteCollection favourites;
        public static FavouriteCollection Favourites
        {
            get
            {
                if (favourites == null)
                {
                    favourites = new FavouriteCollection();
                }
                return favourites;
            }
        }

        private static IEnumerable<ProjectionGroup> projections;
        public static IEnumerable<ProjectionGroup> Projections
        {
            get
            {
                if (projections == null)
                {
                    projections = new ProjectionFileReader().ReadFromFile(@"C:\Program Files\MapInfo\Professional\MAPINFOW.PRJ");
                }
                return projections;
            }
        }
    }

    public static class ExtensionMethods
    {
        public static String InQuotes(this string value)
        {
            return "\"" + value + "\"";
        }
    }
}
